package networkDownload;

import java.io.File;
import java.io.IOException;

public class MulTreadDownload {
	public static void main(String[] args) throws IOException {
		File file = new File("filePool/1.txt");
		
		int length = (int) ((int)file.length() / 5);			//1-4线程
		int length5 = length + (((int)file.length()) % 5);		//第五个线程
		
		MyTread thread1[] = new MyTread[5];
		int seek = 0;
		for(int i = 0; i < 4; i++){
			//长度，偏移
			thread1[i] = new MyTread(length, seek);
			seek += length;
		}
		thread1[4] = new MyTread(length5, 4 * length);
		
		for(int i = 0; i < thread1.length; i++){
			thread1[i].start();
		}
	}
}
